var express = require('express');
var Backstage = express.Router();
var dbcomm = require('./util/dbcomm');
var moment = require('moment');
var now = moment().format('YYYY年MM月DD日') ;//日期

Backstage.get('/',function(req,res){
    res.redirect('/Backstage/login/login.html');
    
});

Backstage.get('/login',function(req,res){
    var dates = req.query;
    console.log(dates);
    dbcomm.query("select * from sys_user where userName = '"+dates.username+"'and userPass = '"+dates.password+"'",function(err,data){
        if(err)throw err;
        else{
            if(data.length == 1){
                console.log("登陆成功");
                res.redirect('/Backstage/frame/index.html');
            }else{
                console.log("登陆失败");
                res.redirect('/Backstage/login/login.html');
            }
            
        }
    });
});















module.exports = Backstage;